import {Component,PureComponent} from 'react'
//PureComponent就是在Component基础上自动调用了shouldComponentUpdate函数了,从而对props和state更新做了优化
class Rcc extends Component {
    constructor(){
        super()
        this.state = {
            input:''
        }
        this.changeInput = (event,value) =>{
            //currentTarget绑定的事件元素
            console.log(event.currentTarget)
            console.log(value)
            // target出发事件的元素
            console.log(event.target)
            this.setState({
                input:event.target.value
            })
        }
    }
    render(){
        const {input} = this.state
        return <div>
            <input type="text" value={input} onChange={(event)=>this.changeInput(event,'zhang')} />
        </div>
    }
}

export default Rcc
